<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="user.name">{{user.name}}

    </div>
    <script>
        const { createApp } = Vue
        
        createApp({
            data() {
                return {
                    user:{
                        name:"默认值"
                    }
                    
                }
            },
            watch:{
                user:{//深层侦听器
                    handler(newValue, oldValue) {
                        console.log(newValue);
                        console.log(oldValue);
                    },
                    deep: true
                }
            }
        }).mount('#app')
    </script>
</body>
</html>

